<%-- 
    Document   : AddConsultant
    Created on : Feb 27, 2014, 11:03:27 AM
    Author     : Mukesh
--%>

<%@page import="StoreType.StoreTypeBean"%>
<%@page import="Vendor.VendorBean"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Vector"%>
<%
    try {
        if (session.getAttribute("uid") != null) {
            if (session.getAttribute("Purchase_Order").toString().equals("1")) {
%>
<%String to = "", status = "", msg = "";%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>Ramgovind Automated System</title>
        <link rel="stylesheet" href="/RIT/css/bootstrap.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap-responsive.css">
        <link rel="stylesheet" href="/RIT/css/jquery.fancybox.css">
        <link rel="stylesheet" href="/RIT/css/style.css">
        <link rel="stylesheet" href="/RIT/css/iconfont.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap.datepicker.css">
        <script src="../../ajax/ajax.js"></script>
        <script>
            function total(iqty, iunit, itax, itamnt) {
                var qty = parseInt(document.getElementById(iqty).value);
                var unit = parseInt(document.getElementById(iunit).value);
                var tax = parseInt(document.getElementById(itax).value);
                var tamnt = (((qty * unit) / 100) * tax) + (qty * unit);
                document.getElementById(itamnt).value = tamnt;
            }
        </script>
    </head>
    <body>
        <%@include file="/topheader.html" %>
        <%@include file="/servicesheader.html" %>
        <div class="main">
            <div class="container-fluid">
                <%@include file="/Services/Inventory/inventorysidenav.jsp" %>
                <div class="content">
                    <%if (session.getAttribute("status") != null) {
                            status = session.getAttribute("status").toString();
                            msg = session.getAttribute("msg").toString();
                    %>
                    <div class="alert alert-info alert-block">
                        <a class="close" data-dismiss="alert" href="#"><img src="/RIT/img/mclose.png"></a>
                        <h4 class="alert-heading"> <%=status%></h4>
                        <%=msg%>

                    </div>
                    <%session.removeAttribute("status");
                            session.removeAttribute("msg");
                        }%>
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="box">
                                <div class="box-head">
                                    <h3>Add Purchase Order</h3>
                                    <a href="PurchaseOrder.jsp">
                                        <button style="float: right" class="btn btn-success">View Purchase Order</button>
                                    </a>
                                </div>
                                <form action="/RIT/AddPurchaseOrder" method="post" class='validate form-horizontal'>
                                    <div class="box-content">
                                        <!---Form Start....-->

                                        <div id="lside" style="float: left; margin-top: 10px;">
                                            <div class="control-group">
                                                <label for="pname" class="control-label">Product Name<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="pname" id="vname" class='required'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="vendor" class="control-label">Vendor<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select class="required" name="vendor" id="vendor">
                                                        <option value="">Select Vendor</option>
                                                        <%{
                                                            Vector<Object> list = Vendor.Query.viewAll();
                                                            Iterator it = list.iterator();
                                                            while (it.hasNext()) {
                                                                VendorBean vb = (VendorBean) it.next();
                                                        %>
                                                        <option value="<%=vb.getVendorId()%>"><%=vb.getVendorName()%></option>
                                                        <%}}%>
                                                    </select>

                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="storetype" class="control-label">Store Type<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select class="required" name="storetype" id="storetype">
                                                        <option value="">Select Store Type</option>
                                                        <%{
                                                            Vector<Object> list = StoreType.Query.viewAll();
                                                            Iterator it = list.iterator();
                                                            while (it.hasNext()) {
                                                                StoreTypeBean sb = (StoreTypeBean) it.next();
                                                        %>
                                                        <option value="<%=sb.getStoreTypeId()%>"><%=sb.getStoreType()%></option>
                                                        <%}}%>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="email" class="control-label">Quantity<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="qty" id="qty" class='required number'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="unitprice" class="control-label">Unit Price<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="unitprice" id="unitprice" class='required number'>
                                                </div>
                                            </div>
                                            
                                        </div>
                                        <div id="rside" style="float: left; margin-right: 120px; margin-top: 10px">
                                            <div class="control-group">
                                                <label for="tax" class="control-label">TAX<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="tax" id="tax" class='required number' onblur="total('qty', 'unitprice', 'tax', 'tamnt')">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="tamnt" class="control-label">Total Amount<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="tamnt" id="tamnt" class="required">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="desc" class="control-label">Description<span style="color:red"></span></label>
                                                <div class="controls">
                                                    <textarea name="desc" id="desc" style="height: 120px;"></textarea>
                                                </div>
                                            </div>
                                        </div>
                                        <!---Form Ends....-->
                                    </div>
                                    <div class="form-actions">
                                        <input type="submit" class='btn btn-primary'>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>	
            </div>
        </div>
        <script src="/RIT/js/jquery.js"></script>
        <script src="/RIT/js/less.js"></script>
        <script src="/RIT/js/bootstrap.min.js"></script>
        <script src="/RIT/js/jquery.uniform.min.js"></script>
        <script src="/RIT/js/bootstrap.timepicker.js"></script>
        <script src="/RIT/js/bootstrap.datepicker.js"></script>
        <script src="/RIT/js/chosen.jquery.min.js"></script>
        <script src="/RIT/js/jquery.fancybox.js"></script>
        <script src="/RIT/js/plupload/plupload.full.js"></script>
        <script src="/RIT/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
        <script src="/RIT/js/jquery.cleditor.min.js"></script>
        <script src="/RIT/js/jquery.inputmask.min.js"></script>
        <script src="/RIT/js/jquery.tagsinput.min.js"></script>
        <script src="/RIT/js/jquery.mousewheel.js"></script>
        <script src="/RIT/js/jquery.textareaCounter.plugin.js"></script>
        <script src="/RIT/js/ui.spinner.js"></script>
        <script src="/RIT/js/jquery.jgrowl_minimized.js"></script>
        <script src="/RIT/js/jquery.form.js"></script>
        <script src="/RIT/js/jquery.validate.min.js"></script>
        <script src="/RIT/js/bbq.js"></script>
        <script src="/RIT/js/jquery-ui-1.8.22.custom.min.js"></script>
        <script src="/RIT/js/jquery.form.wizard-min.js"></script>
        <script src="/RIT/js/jquery.cookie.js"></script>
        <script src="/RIT/js/jquery.metadata.js"></script>
        <script src="/RIT/js/custom.js"></script><script src="/RIT/js/demo.js"></script>
        <script src="/RIT/js/iconfont.js"></script>
    </body>
</html>

<%} else {
%>
<script type="text/javascript">
    alert("You Are Not Authorised");
    window.history.back();
</script>
<%             }
        } else {
            request.setAttribute("msg", "You Are Not Authorised! Please Contact to System Administrator!");
            request.setAttribute("value", "0");
            getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
        }
    } catch (Exception e) {
        request.setAttribute("msg", "Please Contact to System Administrator!");
        request.setAttribute("value", "0");
        getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
    }
%>

